<template>
    <div>
        <van-search v-model="value" shape="round" background="#4fc08d" placeholder="请输入搜索关键词" />

        <van-row>
            <van-col span="6">
                <van-sidebar v-model="active">
                    <van-sidebar-item v-for="item in categories" :title="item.cat_name" />
                </van-sidebar>

            </van-col>
            <van-col span="18">
                <div v-for="item in categories[active]?.children">
                    <h4>{{ item.cat_name }}</h4>
                    <van-grid :column-num="4">
                        <router-link></router-link>
                        <van-grid-item v-for="item in item.children" :icon="item.cat_icon
                            " :text="item.cat_name" @click="tlb"/>
                    </van-grid>
                </div>
            </van-col>
        </van-row>
    </div>
</template>

<script setup>
import router from '@/router'
import { ref } from 'vue';
const active = ref(0);
import { categoriesApi } from '@/api/api'
let categories = ref([])
categoriesApi().then(res => {
    console.log('分类', res)
    categories.value = res.data.message
})
const tlb=()=>{
    router.push('/home/lb')
}
</script>

<style lang="scss" scoped></style>